package com.tedu.day06mybatis.mapper;


import com.tedu.day06mybatis.pojo.Comment;
import com.tedu.day06mybatis.pojo.CommentVO1;
import com.tedu.day06mybatis.pojo.CommentVO2;
import org.apache.ibatis.annotations.*;

@Mapper
public interface CommentMapper {
    @Insert("INSERT INTO comment(content,created,user_id,weibo_id) " +
            "VALUES (#{content},#{created},#{userId},#{weiboId})")
    int insertComment(Comment comment);
    @Delete("DELETE FROM comment WHERE id=#{id}")
    int deleteCommentById(int id);
    @Update("UPDATE comment SET content=#{content},created=#{created},user_id=#{userId},weibo_id=#{weiboId} " +
            "WHERE id=#{id}")
    int updateCommentById(Comment comment);
    @Select("SELECT content,user_id FROM comment WHERE id=#{id}")
    CommentVO1 selectCommentById(int id);
    @Select("SELECT id,content,user_id userId FROM comment WHERE user_id=#{userId}")
    CommentVO2 selectCommentByUserId(int userId);
}
